<template>
	<!-- 猜你喜欢 -->
	<view class="promotion margin-top">

		<view class="cu-bar bg-white margin-top  solid-bottom">
			<view class="action"><text class="cuIcon-titles text-red"></text>{{title}}</view>
			<text class="text-right" @tap="toMore(url)">更多>></text>
		</view>
		<view class="list">
			<navigator class="column" v-for="(row, index) in options" :url="'/pages/new/detail/detail?id='+row.id" :key="index">
				<view class="top">
					<image mode="aspectFill" :src="row.thumb.indexOf('Attachment')!=-1?(imgRoot+row.thumb):row.thumb"></image>
				</view>
				<view class="center">
					<text class="text-gray">{{ row.housename }}</text>
				</view>
				<view class="bottom1">
					<text class="text-green">{{ row.areaname }}</text>
				</view>
			</navigator>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgRoot: this.$rootUrl
			}

		},
		props: {

			options: {
				type: Array,
				default: function(e) {
					return [{
						thumb: ''
					}]
				}
			},
			url: {
				type: String,
				default: function(e) {
					return ""
				}
			},
			title: {
				type: String,
				default: function(e) {
					return "猜你喜欢"
				}
			}
		},
		// computed: {
		//     CoverImage: function () {
		// 		if(this.options.thumb!=undefined&&this.options.thumb!=null)
		// 		{
		// 			return this.options.thumb.indexOf('Attachment')!=-1?(this.imgRoot+this.options.thumb):this.options.thumb
		// 		}
		// 		else{
		// 			return "";
		// 		}
		//     }

		// },
		methods: {
			click() {
				this.$emit('click');
			},
			close(e) {
				this.$emit('close');
			},
			toMore(url) {
				if(url=='/pages/new/hot')
				{
					uni.navigateTo({
						url:url
					});
				}
				else
				{
					uni.switchTab({
						url: url
					});
				}

			},
			toPromotion() {
				uni.navigateTo({
					url: '../../goods/goods'
				});
			}
		}
	}
</script>

<style lang="scss">
	.promotion {
		background: #ffffff;

		.text {
			width: 100%;
			color: #3c3c3c;
			line-height: 50upx;
			font-size: 20upx;
			font-weight: 600;
			border-left: blue 2px solid;
			border-bottom: solid 1rpx #ebebeb;
		}

		.list {
			width: 100%;
			display: flex;
			justify-content: space-between;

			.column {
				flex: 1;
				padding: 15upx 1%;
				overflow: hidden;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				flex-wrap: wrap;

				.top {
					width: 100%;
					display: flex;
					align-items: center;
					margin-bottom: 5upx;

					image {
						height: 150upx;
					}

					.title {
						font-size: 30upx;
					}
				}

				.center {
					font-size: 20upx;
					padding: 3px;
					color: #000000;
				}

				.bottom1 {
					font-size: 17upx;

					.text-green {

						padding: 4px;
						margin-left: 4px;
						background: #DDDDDD;
					}
				}

			}
		}
	}
</style>
